home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir36
/
fpick23a.zip
/
FPICK.DOC
next >
Wrap
Text File
|
1993-03-29
|
37KB
|
1,012 lines
FPICK Version 2.3a March 29, 1993
======================================================================
AUTHOR: Stephen Ferg
5113 N. 8th Road
Arlington, VA 22205-1201
USA
telephone (voice, not FAX): (703) 525-2241
CompuServe ID : 73377,1157
=======================================================================
Table of Contents
Page numbers in the WordPerfect version of FPICK.DOC (which is not
distributed with FPICK) are lost in the conversion to ASCII format.
Nevertheless, these page numbers give you a rough idea of the relative
locations of the different sections.
WHAT IS FPICK?. . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
FPICK PARAMETERS. . . . . . . . . . . . . . . . . . . . . . . . . . . 5
OVERVIEW OF PARAMETERS . . . . . . . . . . . . . . . . . . . . . . 5
FILEMASK PARAMETER /M. . . . . . . . . . . . . . . . . . . . . . . 6
WINDOW COLOR PARAMETER /C. . . . . . . . . . . . . . . . . . . . . 6
ITEM TYPE PARAMETER /T . . . . . . . . . . . . . . . . . . . . . . 7
FUNCTION PARAMETER /F and FPICK OUTPUTS. . . . . . . . . . . . . . 8
FUNCTIONS THAT IMMEDIATELY RETURN RESULTS. . . . . . . . . . . . 9
FUNCTIONS THAT USE THE PICKLIST WINDOW . . . . . . . . . . . . . 10
NOTE ON THE "EXT" FUNCTION . . . . . . . . . . . . . . . . . . . 11
EXCLUDE FILE PARAMETER /X. . . . . . . . . . . . . . . . . . . . . 12
WARNING ABOUT REDIRECTING FPICK OUTPUT!. . . . . . . . . . . . . 13
FPICK'S MAXIMUM CAPACITY . . . . . . . . . . . . . . . . . . . . . 14
HOW TO MOVE FPICK'S CURSOR . . . . . . . . . . . . . . . . . . . . 14
USING FPICK ON A NETWORK . . . . . . . . . . . . . . . . . . . . . 15
HOW TO PUT FPICK OUTPUT INTO AN ENVIRONMENT VARIABLE. . . . . . . . . 16
CALL A BATCH FILE. . . . . . . . . . . . . . . . . . . . . . . . . 16
USE AN ENVIRONMENT-MANIPULATION UTILITY. . . . . . . . . . . . . . 16
FPICK'S /V PARAMETER . . . . . . . . . . . . . . . . . . . . . . . 17
/V WHEN USING 4DOS, NDOS, AND UMB. . . . . . . . . . . . . . . . . 18
FPICK'S ERROR HANDLING. . . . . . . . . . . . . . . . . . . . . . . . 19
EXAMPLES OF HOW TO USE FPICK. . . . . . . . . . . . . . . . . . . . . 20
:01 Display FPICK output on screen . . . . . . . . . . . . . . . . 20
:02 Redirect FPICK output to a file. . . . . . . . . . . . . . . . 20
:03 Put FPICK output in an environment variable using a batch file 20
:04 Put FPICK output in environment variable FPICK using /V parm . 20
:05 Put FPICK output in environment variable FILE1 using /V parm . 20
:06 Put FPICK output in an environment variable using STRINGS. . . 20
:07 Put FPICK output in an environment variable using GET. . . . . 20
:08 Check FPICK output for unexpected results (version 1). . . . . 21
:09 Check FPICK output for unexpected results (version 2). . . . . 21
:11 Pick a .DOC file to browse using LIST. . . . . . . . . . . . . 21
:12 Save your drive & directory, so you can return to them . . . . 22
:21 Pop up a picklist of subdirectories. . . . . . . . . . . . . . 22
:31 How to call FPICK from a REXX program. . . . . . . . . . . . . 23
DISTRIBUTION ISSUES . . . . . . . . . . . . . . . . . . . . . . . . . 24
USE, REGISTRATION, AND DISTRIBUTION OF FPICK . . . . . . . . . . . 24
WHERE TO FIND THE MOST CURRENT VERSION OF FPICK. . . . . . . . . . 25
UPLOADING FPICK TO ELECTRONIC BULLETIN BOARDS. . . . . . . . . . . 25
CONTENTS OF THE FPICK.ZIP DISTRIBUTION FILE. . . . . . . . . . . . 25
FPICK REVISION HISTORY . . . . . . . . . . . . . . . . . . . . . . 25
WHAT IS FPICK?
==============
FPICK is a utility for providing a file picklist capability in a batch
file. It displays a list of files whose names conform to a given filemask.
It then allows a user to scroll through the list using the UParrow,
DOWNarrow, PageUp, and PageDown keys of the keyboard, and to pick a file
from the list by pressing ENTER when the desired filename is highlighted.
The name of the picked file can be placed into an environment variable,
where it is available for use by subsequent statements in the batch file.
You can use FPICK to allow a user to pick a file for subsequent editing,
copying, deletion, or browsing.
If the user presses ESC when working with the picklist, FPICK's output will
be the 4-character string ":ESC". Since the character ":" will never occur
as the first character in a valid filename, this output cannot be mistaken
for a filename.
If FPICK is unable to find any files that match the filemask, it will
terminate without displaying a picklist, and its output will be the 2-
character string ":0".
You can also have FPICK tell you the number of files or directories that
match a filemask, rather than popping up a picklist.
The simplest way to get a feel for what FPICK can do, is to try it. Copy
the text on the next page into a batch file, and then run it.
FPICK is freeware, or what is technically known as "zero-cost shareware".
There is no requirement to pay for or register FPICK in any way. For more
details, see the DISTRIBUTION ISSUES section.
NOTE
====
The following batch file should run correctly in most environments.
If it does not, replace the line:
fpick /V
with the following three lines:
fpick /P"@set fpick=">junktemp.bat
call junktemp.bat
del junktemp.bat
If you have to do this in order to make the batch file work, then look at
the discussion of the /V parameter later in this documentation for an
explanation of the possible reasons.
@echo off
rem ---------------- begin demo batch file ------------------------
cls
REM Give the user instructions on why you want him to pick a file
REM --------------------------------------------------------------
echo Please pick a file whose contents you
echo would like to see TYPE'd to the screen.
echo.
echo I suggest you pick a short text file.
echo.
REM --------------------------------------------------------------
REM Pop up a list of all files that meet the filemask: *.*
REM Put the name of the file the user picks into e-var FPICK
REM --------------------------------------------------------------
fpick /v
REM --------------------------------------------------------------
REM If the user pressed ESC, and exited without picking a file,
REM then do no more processing.
REM --------------------------------------------------------------
if (%fpick%)==(:ESC) echo You did not pick a file.
if (%fpick%)==(:ESC) goto endit
REM --------------------------------------------------------------
REM The user picked a file. TYPE it.
REM --------------------------------------------------------------
echo Ready to type file: %fpick%
pause
cls
type %fpick%
:endit
REM Cleanup the environment after yourself: delete the FPICK e-var.
REM --------------------------------------------------------------
set fpick=
rem ---------------- end of demo batch file ------------------------
FPICK PARAMETERS
================
All parameters are optional. If not specified, they all have default
values that are assumed.
If the /H parameter or the /? parameter is specified, FPICK displays a help
screen.
Parameters can be in any order and upper or lower case.
Note that although parms are not case sensitive, they are "text
sensitive". If any characters are missing, added, or mistyped, the
parameter will be rejected.
OVERVIEW OF PARAMETERS
======================
FPICK /Ffunction /Mfilemask /H /? /Ttype
/Vevarname /Pstring /Sstring
/F specifies the FPICK function to perform.
If omitted, /Ffull is assumed.
/M specifies a filemask for the files in FPICK's picklist.
If omitted, *.* is assumed.
/T specifies type of item (file or directory) to search for.
If omitted, F (file) is assumed.
/C specifies background color for picklist window.
If omitted, C (cyan) is assumed.
/V If present, this parameter specifies that output is to be placed in an
environment variable rather than written to standard output.
If /V is specified but not followed by the name of an environment
variable, then /VFPICK is assumed, and output is placed in the FPICK
environment variable.
/P specifies a prefix string for the output.
/S specifies a suffix string for the output.
These optional parameters, if specified, must be enclosed in single
quotes, double quotes, or square brackets.
In these parameters, a group of spaces will be treated as a single
space, so it is pointless to try to format them by inserting spaces.
The /P feature is useful if you use a batch file to put FPICK's output
into the environment. See the discussion of that topic later in this
documentation.
FILEMASK PARAMETER /M
======================
The filemask can contain the standard DOS "*" and "?" wildcards.
A filemask can contain disk and path qualifications.
All of the following are examples of acceptable filemasks:
/M*.*
/M*.doc
/Mmyprog*.*
/Mbackup?.log
/Mc:\utils\*.doc
/M\*.doc
/M..\*.doc
/M.\*.doc
Unlike the DOS command processor, FPICK does NOT recognize "." as an
abbreviation for "*.*" in a filemask.
/M*.* is acceptable
/M. is NOT acceptable
WINDOW COLOR PARAMETER /C
=========================
The /C (color) parm controls the background color of the window of FPICK's
picklist. It must be one letter. Valid letters and their meanings are:
B blue
G green
R red
C cyan
M magenta
If the /C parm is not specified, the default value of C (cyan) is used.
rem EXAMPLE: show picklist on red background
fpick /v /cR
ITEM TYPE PARAMETER /T
=========================
The /T (type) parm controls whether the picklist displays the names of
files or subdirectories. Valid letters and their meanings are:
F files
D directories
Note that if FPICK is asked to gather information on directories, it does
not display, nor count, the names of the current directory (whose name is
".") and the parent directory (whose name is "..").
In contrast, DOS's DIR command (when it is run on any directory other
than the root directory of a disk) does show and count these names.
Consequently, if you ask FPICK to count the number of files in a (non-
root) directory, and the number of subdirectories, and then add the
two numbers together, the total will be 2 less than the number you get
from DOS's DIR command.
If the /T parm is not specified, the default value of F (files) is used.
rem EXAMPLE: show picklist of subdirectories of C:\
fpick /v /mC:\* /tD
NOTE
====
Although it is not customary to give a directory a name that has an
extension, it IS possible to do so under DOS 5.0 (and perhaps with earlier
versions of DOS as well).
I recommend, therefore, that unless you have some specific reason not to do
so, when using the /TD parameter, your filemask parameter (/M) should
always include an extension of "*".
FUNCTION PARAMETER /F and FPICK OUTPUTS
=======================================
The /F (function) parameter is used to control the function that FPICK
performs. The default is "full". That is, if /F is not specified, the
result is the same as if you had specified the parameter "/Ffull" when
invoking FPICK.
Some of FPICK's functions return a result immediately, without popping up a
picklist window. Others cause a picklist window to pop up, and return a
result based on the filename that the user selects from the list.
The next two subsections discuss:
FUNCTIONS THAT IMMEDIATELY RETURN RESULTS, and
FUNCTIONS THAT USE THE PICKLIST WINDOW,
respectively.
FUNCTIONS THAT IMMEDIATELY RETURN RESULTS
-----------------------------------------
num returns the number of files or subdirectories that match filemask.
returns "0" (zero) if no files or subdirectories match filemask.
If /T parm is /TF (files):
returns the number of files that match the filemask.
If /T parm is /TD (directories):
returns the number of subdirectories that match the filemask.
DISCUSSION
Before using FPICK to pop up a picklist of filenames, it is often
wise to use DOS's IF EXIST command to verify that at least one file
exists to be picked. Unfortunately, there is no DOS command that
will allow you to verify that at least one subdirectory exists.
FPICK's /FNUM parameter, when used in conjunction with the /TD
parameter, allows you to gets around this DOS limitation. Used
together, /FNUM and /TD will tell you the number of subdirectories
a directory has. See EXAMPLES.
Note that if FPICK does not count the current directory (whose name
is ".") nor the parent directory (whose name is ".."). For any
directory other than the root directory of a disk, DOS's DIR
command does show and count these names. Consequently, if you ask
FPICK to count the number of files in a non-root directory, and
then count the number of subdirectories, and then add the two
numbers together, the total will be 2 less than the number you get
from DOS's DIR command.
See also: WARNING ABOUT REDIRECTING FPICK OUTPUT
disk returns the drive letter of the current disk drive, e.g. "C"
dir returns the name of the current directory, e.g. "C:\UTILS"
Note that the output will NEVER have a trailing backslash.
If you are currently in the root directory of the C drive, the
result will be "C:"
FUNCTIONS THAT USE THE PICKLIST WINDOW
--------------------------------------
These functions pop up a picklist of files (or directories) that meet the
filemask specified on the /M parameter. In the picklist window, the files
will be sorted alphabetically by filename.
The picklist window pops up at column 50 (on the right of the screen) and
overwrites anything in the 30 rightmost columns of the screen. When it
closes, it blacks out the area where it appeared. Given this behavior, the
best way to use FPICK's picklist window in a batch file is to:
* clear the screen (using CLS)
* write up to 23 lines of instruction (using ECHO), keeping the lines
short (no more than about 45 characters)
* invoke FPICK
For a good example of this sort of coding, look at the DEMO batch file that
appears in the first section of this documentation ("What is FPICK?").
The picklist window functions return the name of the file picked, in a
format determined by the function specified on the /F parm.
The names of the valid picklist functions and their corresponding output
formats is as follows. The example assumes that the user has picked a file
whose fully-qualified name is: C:\UTILS\TEST.BAT.
func returns output
---- ---------------------- ---------------------------
full fully qualified name C:\UTILS\TEST.BAT
part path + file prefix C:\UTILS\TEST
name filename TEST.BAT
pre file prefix TEST
ext file extension BAT
If the user presses ESC when working with the picklist, FPICK's output will
be the 4-character string ":ESC". Since the character ":" will never occur
as the first character in a valid filename, this output cannot be mistaken
for a filename.
If FPICK is unable to find any files that match the filemask, it will
terminate without displaying a picklist, and its output will be the 2-
character string ":0".
To avoid having to deal with a possible result of ":0", your batch file
should test for the existence of files that meet the filemask before
invoking FPICK. You can do this using IF NOT EXIST ... GOTO ...
EXAMPLE
if not exist c:\*.doc goto NotFound
FPICK /Mc:\*.doc /V
if not (%Fpick%)==(:ESC) LIST %Fpick%
:NotFound
NOTE ON THE "EXT" FUNCTION
==========================
If you run FPICK with the following parameters:
FPICK /fext /v
and the user picks a file whose name has no extension, FPICK's output will
be "" (i.e. the null, or empty, string). Because assigning the null string
to an environment variable removes it from the environment, the result will
be that the FPICK environment variable will be set to null (i.e. removed
from the environment).
EXCLUDE FILE PARAMETER /X
=========================
The /X (exclude file) parameter excludes a filename from FPICK's
operations.
/X applies only to files, that is, when /TF has been specified explictly or
by default. It does not apply to directories, and is ignored if /TD is
specified.
Example: exclude AUTOEXEC.BAT from FPICK's processing.
FPICK /Xautoexec.bat
In a filename specified on the /X parameter, all characters are interpreted
literally. That is, "?" and "*" are interpreted literally and not as
wildcard characters. Consequently, wildcard characters should never be
used with /X, since they will never occur in a filename.
Since a filename specified using the /X parameter cannot contain wildcards,
only one filename can be excluded from FPICK's processing.
For a discussion of the primary use for the /X parameter, see the next
section: WARNING ABOUT REDIRECTING FPICK OUTPUT!
WARNING ABOUT REDIRECTING FPICK OUTPUT!
=======================================
When DOS sees a redirection symbol in a statement, it creates the file that
is the target of redirection BEFORE it executes the statement whose output
is to be redirected. This pattern of behavior is one of DOS's less
endearing "gotcha's", and one that presents special problems when using
redirection with a program such as FPICK.
It may cause FPICK to return an apparently incorrect answer when you
specify the "/FNUM /TF" (or specify simply "/FNUM" and take the default of
"/TF") and redirect FPICK's output. Suppose you are in a directory that
contains 6 files, and does not contain a file named JUNKTEMP.BAT. If you
run a batch file containing the following statements:
FPICK /FNUM /P"@SET FPICK=" >JUNKTEMP.BAT
call JUNKTEMP.BAT
del JUNKTEMP.BAT
the result will be that the FPICK environment variable reports a filecount
of 7, not 6. The reason: The first statement allocates a zero-length file
called JUNKTEMP.BAT before it runs FPICK. This brings the number of files
in the directory up to 7. FPICK, when it runs, finds seven files and
returns the correct result of "7". After JUNKTEMP.BAT is called in the
second statement, it is deleted in the third. This returns the number of
files in the directory to 6, but leaves the FPICK environment variable
containing the value of "7".
Another undesirable side effect of redirection is that the redirected file
may show up on FPICK's picklist. In the following example, JUNKTEMP.BAT
will show up on the picklist.
FPICK /P"@SET FPICK=" >JUNKTEMP.BAT
call JUNKTEMP.BAT
del JUNKTEMP.BAT
To get around these problems with redirection, FPICK provides the /X
(exclude file) parameter, which excludes a filename from its operations. To
get the desired result, 6, in the first example, code:
FPICK /FNUM /Xjunktemp.bat /P"@SET FPICK=" >JUNKTEMP.BAT
call JUNKTEMP.BAT
del JUNKTEMP.BAT
To get prevent JUNKTEMP.BAT from appearing on the picklist in the second
example, code:
FPICK /Xjunktemp.bat /P"@SET FPICK=" >JUNKTEMP.BAT
call JUNKTEMP.BAT
del JUNKTEMP.BAT
FPICK'S MAXIMUM CAPACITY
========================
FPICK is capable of handling up to 1200 files. Note that if a directory
has several hundred files, it will take FPICK several seconds to count them
or load them into its window.
If FPICK has been asked to retrieve more files than it can handle, it will
return an errorlevel of 1, and it will write the following message directly
to the screen. This message will not be written to standard output, and it
cannot be redirected.
:ERROR: directory contains more files than FPICK can handle.
FPICK's upper limit is 1200 files.
If you suspect that you might encounter this error, your batch file can
test for it by using DOS's "IF ERRORLEVEL 1 GOTO ..." statement immediately
after the line that runs FPICK.
If there are more than 1200 files in a directory that you want to examine
with FPICK, you can reduce the likelihood of exceeding FPICK's capacity by
specifying a filemask parameter that keeps to a minimum the number of files
that FPICK must retrieve. The more precise (i.e. restrictive) you can make
the filemask, the better.
HOW TO MOVE FPICK'S CURSOR
==========================
FPICK's cursor is a lightbar that highlights the filename that it is
pointing to. You can move the cursor up or down in the picklist window by
pressing the up and down arrow keys on your keyboard.
Pressing the PgUp (Page Up) key is the equivalent of pressing the UP arrow
20 times. Similarly, pressing the PgDn (Page Down) key is the equivalent
of pressing the DOWN arrow 20 times.
USING FPICK ON A NETWORK
========================
If you are running in a networked environment, FPICK will always be able to
find files in the current directory. If, however, your filemask indicates
a disk drive, for example:
/Mx:\workdir\*.bat
and the disk drive is a network drive, FPICK will not be able to locate
filenames that match that filemask, and FPICK will immediately return ":0".
The way to get around this limitation is to change to the desired directory
on the network drive before invoking FPICK, then use a filemask that does
not include a disk drive letter.
If you wish, before changing to the network drive, you can use FPICK's
/Fdisk function to obtain and save your current disk drive letter in an
environment variable. Then, after changing to the desired directory on the
network drive and finishing your work, you can use the environment variable
to return to your original directory. Here's how to do it in a batch
file:
rem save the original drive letter
FPICK /Fdisk /Vdisk
rem change to the network drive
X:
CD \WORKDIR
.... do your work ...
rem return to your original drive. (Don't forget the trailing colon :)
%disk%:
rem clean up the environment
set disk=
HOW TO PUT FPICK OUTPUT INTO AN ENVIRONMENT VARIABLE
====================================================
CALL A BATCH FILE
=================
The most basic way to put FPICK's output into an environment variable is
to:
* use the /P (prefix string) feature to create a DOS "SET" statement,
* redirect the output to a batch file, and then
* CALL the batch file.
Since CALL first appeared in DOS 3.3, you will need DOS 3.3 or greater
to use this technique.
FPICK /M*.* /XJUNKTEMP.BAT /P"@SET FPICK=" >JUNKTEMP.BAT
call JUNKTEMP.BAT
del JUNKTEMP.BAT
See also: WARNING ABOUT REDIRECTING FPICK OUTPUT
USE AN ENVIRONMENT-MANIPULATION UTILITY
=======================================
There are shareware and public domain utilities that are written
specifically to manipulate environment variables, and do that job very
well. FPICK's output can be put into an environment variable by piping
it to one of these utilities. When piping FPICK output to a utility,
you can prevent the output from being ECHOed to the screen by
redirecting the output to NUL.
Of these utilities, I can especially recommend Bob Stephan's GET
(because it is a powerful, flexible, and inexpensive shareware package)
and PC Magazine's STRINGS (because it is free to ZiffNet members). See
the EXAMPLES section for examples of how to use STRINGS and GET to put
FPICK's output into an environment variable.
On CompuServe, use IBMFF to look for GET*.ZIP (e.g. GET25.ZIP for
version 2.5) in CIS:IBMSYS, or for GET.ZIP in ZNT:UTILFORUM, lib 16.
GET is also available from the Public Software Library in Houston.
On CompuServe, look for STRING.ZIP in the PC Magazine Utilities Lib of
ZNT:UTILFORUM.
FPICK'S /V PARAMETER
====================
FPICK's /V (environment variable) parameter tells FPICK to put its
output into an environment variable. (FPICK attempts to put output into
an environment variable in the master, rather than the local,
environment.) If you do not use /V, FPICK output is written to standard
output, i.e. to the screen.
/Vevar tells FPICK to put output into an environmental variable whose
name is "evar". For example:
FPICK /Mc:\*.bat /Vpicked1
will set the environment variable PICKED1 to the name of the picked
file. If you type SET at the DOS prompt, you should see something like:
PICKED1=C:\AUTOEXEC.BAT
If you specify /V without an evar name, the evar name defaults to FPICK.
Example : FPICK /Mc:\*.bat /V
produces: FPICK=C:\AUTOEXEC.BAT
Note that due to the complexities of manipulating the environment, there
may be circumstances where /V doesn't work. These include running FPICK
when you have shelled out to DOS from another program, have put the
command processor in upper memory (UMB) (see below), or are running
under Windows, Carousel, etc. In such cases, you may have to fall back
on one of the more basic techniques (described above) for putting
FPICK's output into an environment variable.
For a list of circumstances in which the /V option has been reported as
NOT working, see the next section.
/V WHEN USING 4DOS, NDOS, AND UMB
=================================
There are circumstances in which FPICK /V may not be able to set a variable
in the master environment.
There are options with 4DOS and NDOS to load the environment and part
of the command processor into upper memory blocks. When one of these
options is used, FPICK /V can't find the environment and produces the
message:
ERROR
echo ERROR: Master environment not found
pause
If you have a 4DOS.INI file, it has to contain these lines for FPICK /V
to work:
UMBEnvironment = No
UMBLoad = No
If you have NDOS, the SHELL statement in CONFIG.SYS cannot contain
any reference to UMB loading via /U (which puts NDOS.COM in UMB), nor
can it contain a statement of the form:
/E:xxxU
(which puts xxx bytes of the environment in UMB via the "U" parameter).
Also, NSTART.BTM or 4START.BTM cannot contain
SET NDSHELL=/e+xxxU /U
in which both U's represent UMB loading of the command processor and the
environment during secondary shells.
It is also possible that FPICK /V may fail to work with MS-DOS if you put
the command processor or the environment in Upper Memory.
FPICK'S ERROR HANDLING
======================
If FPICK detects an error:
(1) it will return an errorlevel of 1 (rather than 0), and
(2) its output will be 3 lines:
* the word ERROR
* a DOS batch-file ECHO statement that displays an error message
* a DOS batch-file PAUSE statement
The only exception to this behavior is if FPICK is asked to
retrieve more files than it can handle. For a description of its
behavior in such a case, see the section on FPICK'S CAPACITY,
earlier in this document.
If FPICK output is displayed directly, or redirected to NUL,
you can detect an error by testing the errorlevel for a value of 1.
If FPICK output is piped to an environment manipulation utility such
as STRINGS or GET, the environment variable will be set to ERROR.
Errorlevel will be set by STRINGS/GET, and will probably be 0.
In such a case, the only way to detect an error is to test the
environment variable for the value ERROR.
If FPICK output is redirected to a batch file, which is then
CALLed to set an environment variable, the batch file will:
* set the environment variable to ERROR,
* ECHO the error message, and
* pause.
You can detect an error by testing errorlevel for the value 1
either before or after you CALL the batch file, or
by testing the environment variable for the
value ERROR, AFTER you have CALLed the batch file.
The kinds of mistakes that cause an FPICK error are invalid parameter
values, e.g. a misspelled /F parameter, or an invalid letter on the /T
or /C parameter. The circumstances when you are most likely to need
error-checking statements after running FPICK are circumstance in which
you have obtained the value of an FPICK parameter from an unvalidated
batch-file parameter:
FPICK /M*.* /C%1 /V
if errorlevel 1 echo Invalid colorparm [%1] in parameter 1.
if errorlevel 1 goto endit
EXAMPLES OF HOW TO USE FPICK
============================
:01 Display FPICK output on screen
:==================================================================
FPICK /M*.doc
:02 Redirect FPICK output to a file
:==================================================================
See also: WARNING ABOUT REDIRECTING FPICK OUTPUT
FPICK /M*.doc >FPICK.OUT
:03 Put FPICK output in an environment variable using a batch file
:==================================================================
FPICK /M*.doc /P"@SET FPICK=" >JUNKTEMP.BAT
call JUNKTEMP.BAT
del JUNKTEMP.BAT
:04 Put FPICK output in environment variable FPICK using /V parm
:==================================================================
FPICK /M*.doc /V
:05 Put FPICK output in environment variable FILE1 using /V parm
:==================================================================
FPICK /M*.doc /Vfile1
:06 Put FPICK output in an environment variable using STRINGS
:==================================================================
FPICK /M*.doc |STRINGS FPICK= ASK >NUL
:07 Put FPICK output in an environment variable using GET
:==================================================================
FPICK /M*.doc |GET ZE /VFPICK >NUL
:08 Check FPICK output for unexpected results (version 1)
:==================================================================
@echo off
cls
fpick /m%1 /v
if errorlevel 1 goto endit
for %%v in (:ESC :0) do if (%fpick%)==(%%v) goto %fpick%
echo You picked file %fpick%
pause
LIST %fpick%
goto endit
:0
echo No files exist that match filemask: %1
goto endit
:ESC
echo You did not pick a file.
goto endit
:endit
set fpick=
:09 Check FPICK output for unexpected results (version 2)
:==================================================================
FPICK /M*.doc /v
if errorlevel 1 goto endit
if (%fpick%)==(:0) goto NoneFound
if (%fpick%)==(:ESC) goto NonePicked
...
:11 Pick a .DOC file to browse using LIST
:==================================================================
@echo off
if not exist *.DOC echo There are no .DOC files in this directory.
if not exist *.DOC goto LoopEnd
:LoopTop
cls
echo Select the .DOC file you wish to browse.
Fpick /M*.DOC /V
cls
if (%Fpick%)==(:ESC) goto LoopEnd
LIST %Fpick%
goto LoopTop
:LoopEnd
set Fpick=
:12 Save your drive & directory, so you can return to them
:==================================================================
rem save the original drive letter
FPICK /Fdisk /Vdisk
rem save the original directory spec
FPICK /Fdir /Vdir
rem change to the root directory of the same drive
CD \
rem change to a different drive
G:
.... do your work ...
rem return to your original drive. (Don't forget the trailing colon :)
%disk%:
rem return to your original directory
CD %dir%
rem clean up the environment
set disk=
set dir=
:21 Pop up a picklist of subdirectories
:==================================================================
@echo off
cls
rem check to see if there are any subdirectories
FPICK /FNUM /TD /V
if (%fpick%)==(0) echo There are no subdirectories in this directory.
if (%fpick%)==(0) goto endit
echo Select the subdirectory to change to.
Fpick /TD /V
if (%Fpick%)==(:ESC) goto Endit
CD %Fpick%
:Endit
set Fpick=
:31 How to call FPICK from a REXX program
:==================================================================
Here's how to use FPICK from a REXX program. I have tested it in
conjunction with Quercus's Personal REXX for DOS, and Kilowatt Software's
Portable REXX for DOS.
See also: WARNING ABOUT REDIRECTING FPICK OUTPUT
/* use FPICK from a REXX program */
workfile = "JUNKFILE.TMP"
"FPICK /X"workfile" " >"workfile
choice = linein(workfile)
call lineout workfile /* close workfile */
"del" workfile
/* use CHOICE variable as desired ..... */
DISTRIBUTION ISSUES
===================
USE, REGISTRATION, AND DISTRIBUTION OF FPICK
============================================
FPICK is freeware, or what is known as "zero-cost shareware". FPICK is not
what is technically called "public domain" software because the author
retains the copyright. FPICK can, however, be copied, used, and
distributed freely as long as FPICK.EXE and FPICK.DOC are not altered and
are distributed together.
There is no requirement to register FPICK in any way.
FPICK can be included in shareware packages as long as both FPICK.EXE and
FPICK.DOC are included in the shareware package.
If you have received FPICK as part of some larger shareware package,
please be aware that you may freely use, copy, and distribute FPICK
without paying a fee for, or registering, the larger package.
The author explicitly disavows any claim whatsoever about the
correctness or functionality of FPICK, its documentation, and its
demonstration batch files, and disclaims liability for anything and
everything bad that might happen in connection with, before, during, or
after using it. I have tried to make FPICK work right, but everybody
makes mistakes, so you use FPICK at your own risk.
I don't know if people will find FPICK useful, and I'd like to find
out. If you find FPICK useful and use it on a regular basis, I'd
appreciate it if you would drop me a short note via US mail or
CompuServe, telling me about how you are using FPICK.
WHERE TO FIND THE MOST CURRENT VERSION OF FPICK
===============================================
You will always be able to find the most recent version of FPICK on
CompuServe. The filename will be FPICK.ZIP, and it will be available
in one of the libraries in the CIS:IBMSYS forum (probably library 1).
You can find it by using cross-library searching, looking for the
filename FPICK.ZIP or the keyword FPICK.
UPLOADING FPICK TO ELECTRONIC BULLETIN BOARDS
===============================================
Feel free to post copies of FPICK.ZIP on any BBS that you wish, but
please do not upload it to any CompuServe library. As long as I am the
only one putting copies of FPICK onto CompuServe, we can keep confusion
over versions to a minimum.
CONTENTS OF THE FPICK.ZIP DISTRIBUTION FILE
===========================================
The current distribution package (FPICK.ZIP) contains the following:
FPICK.EXE [the FPICK program]
FPICK.DOC [this file, documentation for FPICK]
FPICK REVISION HISTORY
======================
Letters appended to version numbers indicate modifications to
the doc files, without any modification to the FPICK.EXE software.
Asterisks (*) indicate most important changes in the new version.
1.5b Feb 10, 1993
First public release
1.6a Feb 14, 1993
Corrected minor bug in which the error message reporting an invalid
value for the /T parm displayed in bright (rather than regular) white
1.7a Feb 25, 1993
Added ability to use PageUp and PageDown keys as well as arrow keys
2.0a March 05, 1993
Increased FPICK capacity to 1200 files from 256
Added error message if capacity exceeded
2.1a March 23, 1993
Changed internal implementation of NUM function to increase speed
Corrected bug that caused /FNUM to return incorrect numbers
2.2a March 29, 1993
Corrected a bug in which output of /FNUM, /FDISK, and /FDIR was not
being written to standard output, and so was not redirectable.
2.3a March 29, 1993
Added /X parameter
Added note: WARNING ABOUT REDIRECTING FPICK OUTPUT